<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>员工主页面</title>
    <link rel="stylesheet" type="text/css" href="../../static/admin/layui2/css/layui.css"/>
    <style>
        a:hover{
            color: #00b7ee;
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header" style="background-image: linear-gradient(120deg, #131313,#4c4c4c);">
        <div class="layui-logo"><a href="yuangong-main.html" style="color: #47b3ff;font-size: 25px;">员工主页</a></div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item"><a class="layui-icon" href="../guanliyuan/guanliyuan-login.html">管理员登录</a></li>
            <li class="layui-nav-item"><a class="layui-icon layui-icon-logout" style="color: #ff3c00;font-size: 20px;text-align: center;" href="yuangong-login.html">退出</a></li>
        </ul>
    </div>

    <div class="layui-side" style=" background-image: linear-gradient(120deg, #a7d3f2,#1E9FFF);">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree layui-bg-black"  lay-filter="test">
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-user" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i> 信息管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="yuangong-xinxiChange.html" class="layui-this layui-bg-blue"><i class="layui-icon layui-icon-form" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>基本信息修改</a></dd>
                        <dd><a href="yuangong-mimaChange.html"><i class="layui-icon layui-icon-edit" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>修改密码</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-iteme">
                    <a class="" href="yuangong-apply.html"><i class="layui-icon layui-icon-form" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>宿舍申请</a>
                </li>
                <li class="layui-nav-item layui-nav-iteme">
                    <a class="" href="letter-box.html"><i class="layui-icon layui-icon-notice" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>通知</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <div class="layui-anim layui-anim-scale" style="margin-top: 50px;margin-left: 50px;">
            <form class="layui-form layui-form-pane" name="form1" id="form1">
                <div class="layui-form-item">
                    <label class="layui-form-label">员工号</label>
                    <div class="layui-input-inline">
                        <input type="text" name="yuangongHao" id="yuangongHao" class="layui-input" disabled>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="xinming" id="xinming" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-block">
                        <input type="radio" name="xinbie" id="nan" value="1" title="男">
                        <input type="radio" name="xinbie" id="nu" value="0" title="女">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">所在部门</label>
                    <div class="layui-input-block">
                        <input type="text" name="suozaiBumem" id="suozaibumem" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">手机</label>
                    <div class="layui-input-block">
                        <input type="text" name="shouji" id="shouji" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">工作电话</label>
                    <div class="layui-input-block">
                        <input type="text" name="gongzuoDianhua" id="gongzuoDianhua" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">学历</label>
                    <div class="layui-input-inline">
                        <select name="xueli" id="xueli">
                            <option value="中专">中专</option>
                            <option value="大专">大专</option>
                            <option value="本科">本科</option>
                            <option value="硕士">硕士</option>
                            <option value="博士">博士</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">入行时间</label>
                    <div class="layui-input-inline">
                        <input type="text" name="ruhangShijian" id="ruhangShijian" lay-verify="date" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">身份证号</label>
                    <div class="layui-input-block">
                        <input type="text" name="shengfenZhenghao" id="shengfenZhenghao" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">银行卡号</label>
                    <div class="layui-input-block">
                        <input type="text" name="yinhangKahao" id="yinhangKahao" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">地址</label>
                    <div class="layui-input-block">
                        <input type="text" name="dizhi" id="dizhi" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="button" class="layui-btn layui-btn-normal" onclick="function replaceDoc() {
                        location.reload();
                        }
                        replaceDoc()" lay-filter="demo2">恢复</button>
                        <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">修改</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="layui-footer layui-bg-black">
    </div>
</div>
<script src="../../static/admin/layui2/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['element','form','jquery','layer','laydate'], function(){
        var element = layui.element
        var form = layui.form
        laydate = layui.laydate
        layer = layui.layer
            $ =layui.jquery;

        laydate.render({
            elem: '#ruhangShijian'
        });

        $.ajax({
            type:"POST",
            url :"/yuangong/showallxinxi",
            dataType:"json",
            success:function(data){
                $("#yuangongHao").val(data.yuangongHao);
                $("#xinming").val(data.xinming);
                $("input[name=xinbie][value=1]").attr("checked", data.xinbie == 1 ? true : false);
                $("input[name=xinbie][value=0]").attr("checked", data.xinbie == 0 ? true : false);
                form.render()
                $("#suozaibumem").val(data.suozaiBumem);
                $("#shouji").val(data.shouji);
                $("#gongzuoDianhua").val(data.gongzuoDianhua);
                $("#xueli").val(data.xueli);
                $("#ruhangShijian").val(data.ruhangShijian);
                $("#shengfenZhenghao").val(data.shengfenZhenghao);
                $("#yinhangKahao").val(data.yinhangKahao);
                $("#dizhi").val(data.dizhi);
            }
        })
        form.render();
        form.on('submit(demo1)',function (data) {
            $.ajax({
                type:"POST",
                url:"/yuangong/updateallxinxi",
                data:{
                    "yuangongHao": data.field.yuangongHao,
                    "xinming": data.field.xinming,
                    "xinbie": data.field.xinbie,
                    "suozaiBumem": data.field.suozaiBumem,
                    "shouji":data.field.shouji,
                    "gongzuoDianhua":data.field.gongzuoDianhua,
                    "xueli":data.field.xueli,
                    "ruhangShijian":data.field.ruhangShijian,
                    "shengfenZhenghao":data.field.shengfenZhenghao,
                    "yinhangKahao":data.field.yinhangKahao,
                    "dizhi":data.field.dizhi,
                },
                dataType:"json",
                success:function (res) {
                    if (res.flag){
                        window.location.href="yuangong-xinxiChange.html";
                        alert("修改成功");
                    }else {
                        $("#ms").html(res.msg);
                    }
                }
            })
            return false;
        });
    });
</script>
</body>
</html>